import {legacy_createStore} from 'redux'// 从 redux 库中导入 legacy_createStore 方法，用于创建 Redux store
import rereducer from './reducer'
import { persistStore, persistReducer } from 'redux-persist'// 从 'redux-persist' 库中导入 persistStore 和 persistReducer，用于实现 Redux 状态的持久化
import storage from 'redux-persist/lib/storage' //  localStorage 持久化的数据存在哪里

 //对持久化进行设置
const persistConfig = {
//定义的名字
    key: 'wenzhang',
//使用localStorage存储的方式
    storage,
  }
  const persistedReducer = persistReducer(persistConfig, rereducer)//将reducer和持久化配置合并
  export const store = legacy_createStore(persistedReducer)//创建store 存放持久化的reducer
  export const  persistor = persistStore(store)//创建持久化存储